<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;


class CreateRentClothOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('rent_cloth_orders', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->tinyInteger('type')->default(1)->comment('晒单类型1线上2线下');
            $table->integer('rent_id')->default(0)->comment('=rent_clothes.id');
            $table->integer('shop_id')->default(0)->comment('=shops.id');
            $table->integer('user_id')->default(0)->comment('=users.id');
            $table->integer('com_id')->default(0)->comment('=commodities.id');
            $table->integer('com_attr_id')->default(0)->comment('=commodity_attr.id');
            $table->integer('brand_id')->default(0)->comment('=brands.id');
            $table->text('content')->comment('晒单内容');
            $table->string('img_url',2000)->default('')->comment('晒单图片');
            $table->unsignedInteger('hot_spot')->default(0)->comment('点赞数');
            $table->unsignedInteger('browse_num')->default(0)->comment('浏览数');
            $table->integer('reward')->default(0)->comment('获得奖励次数');
            $table->tinyInteger('status')->comment('状态1审核中2已通过3未通过');
            $table->string('comment')->default('')->comment('备注');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `rent_cloth_orders` comment '租衣晒单表';");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('rent_cloth_orders');        
    }
}
